home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / misc / defs / misc.h < prev    next >
C/C++ Source or Header  |  1992-05-23  |  3KB  |  112 lines

  1. //
  2. //
  3. // Copyright (C) 1991 Texas Instruments Incorporated.
  4. //
  5. // Permission is granted to any individual or institution to use, copy, modify,
  6. // and distribute this software, provided that this complete copyright and
  7. // permission notice is maintained, intact, in all copies and supporting
  8. // documentation.
  9. //
  10. // Texas Instruments Incorporated provides this software "as is" without
  11. // express or implied warranty.
  12. //
  13. // This file  contains  useful definitions,  macros, and constants used through
  14. // out most header and source files.
  15. //
  16.  
  17. #ifndef MISCELANEOUSH                // If no miscelaneous header
  18. #define MISCELANEOUSH
  19.  
  20. #include <values.h>                // platform specific constants
  21.  
  22. #ifndef DEFSH
  23. #include <defs.h>                // Include the defs header
  24. #endif
  25.  
  26. /*
  27. #if (defined(MSDOS) && !defined(DOS))          // For IBM or MS compilers
  28. #define DOS
  29. #endif
  30. */
  31.  
  32. #ifndef INVALID                    // Define INVALID for curpos
  33. #define INVALID (-1)
  34. #endif
  35.  
  36. #ifndef END_OF_STRING                // If END_OF_STRING not defined
  37. #define END_OF_STRING (0)
  38. #endif
  39.  
  40. #ifndef NEWLINE                    // If Newline char not defined
  41. #define NEWLINE '\n'
  42. #endif
  43.  
  44. #ifndef SENSITIVE                // If case flags not defined
  45. #define SENSITIVE TRUE
  46. #define INSENSITIVE FALSE
  47. #endif
  48.  
  49. #ifndef MINSHORT
  50. #define MINSHORT  ((short)(1 << BITS(short) - 1))
  51. #endif
  52. #ifndef MININT
  53. #define MININT  (1 << BITS(int) - 1)
  54. #endif
  55. #ifndef MINLONG
  56. #define MINLONG  (1L << BITS(long) - 1)
  57. #endif
  58.  
  59. #ifndef NUMBER_STATES
  60. #define NUMBER_STATES
  61. enum N_status { N_OK, N_MINUS_INFINITY, N_PLUS_INFINITY, N_OVERFLOW,
  62.         N_UNDERFLOW, N_NO_CONVERSION, N_DIVIDE_BY_ZERO };
  63. #endif
  64.  
  65. /*
  66.   In values.h
  67. #define MAXDOUBLE    1.79769313486231470e+308
  68. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  69. #define MINDOUBLE    4.94065645841246544e-324
  70. #define MINFLOAT    ((float)1.40129846432481707e-45)
  71. */
  72.  
  73. #define    _IEEE        1
  74. #define _DEXPLEN    11
  75. #define _HIDDENBIT    1
  76. #define DMINEXP    (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  77. #define FMINEXP    (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  78.  
  79. #ifndef ABS
  80. #define ABS(x) ((x >= 0) ? (x) : (-x))
  81. #endif
  82.  
  83. // even --  Determine if long integer is odd of even
  84. // Input:   long integer
  85. // Output:  Boolean TRUE/FALSE
  86.  
  87. inline Boolean even (long n) {
  88.   return ((n & 1) ? FALSE : TRUE);
  89. }
  90.  
  91. // odd --  Determine if long integer is odd of even
  92. // Input:  long integer
  93. // Output: Boolean TRUE/FALSE
  94.  
  95. inline Boolean odd (long n) {
  96.   return ((n & 1) ? TRUE : FALSE);
  97. }
  98.  
  99. // The "#pragma defmacro" is a COOL extension to the standard  ANSI C processor
  100. // that allows  a programmer to  define macro  extensions to the  language. All
  101. // COOL  macros   have  been  incorporated  into  the preprocessor   itself  to
  102. // facilitate extra speed and efficiency. User defined  extensions are searched
  103. // for on the include file path.
  104.  
  105. #pragma defmacro MACRO "macro" delimiter=} recursive
  106. #pragma defmacro template "template" delimiter=}
  107. #pragma defmacro DECLARE "declare" delimiter=> recursive lines
  108. #pragma defmacro IMPLEMENT "implement" delimiter=> recursive lines
  109.  
  110. #endif MISCELANEOUSH                // End #ifdef
  111.  
  112.